OSD - Scripts - Prod
This is a script libary used during OAL Task Sequences. OS Deployment need to be conistant and reliable, keeping the scripts as bare bones as possible allows for that. Each one serves a single purpose and are isolated from each other so when making changes they are less likely to cause a cascading effect.
Table Of Contents
- Get-ADInformation.ps1
- Invoke-OALMenu.ps1
- Invoke-PSActiveDirectory.ps1
- New-ComputerName.ps1
- Remove-ADComputer.ps1
- Set-ADInformation.ps1
- Set-OALRegistryKeys.ps1
Get-ADInformation.ps1
Based on the OSDComputerName value, searches for the computer in Active Directory. If computer is present, sets the COMPUTERDESCRIPTION and DEPARTMENT OSD Variables. DEPARTMENT is calculated buy what OU the computer is in, majority of the time is will be OAL.
If the computer is not found these variables will be is empty but present.
Get-ADInformation.ps1
[-Server <String>]
Invoke-OALMenu.ps1
Shows the OAL menu that allows the admin to set all the necessary values for OAL's workflows and automated systems. If the COMPUTERDESCRIPTION OSD Variable is not empty, the menu will be prefilled with those values. When the menu is closed, it sets all the values for the rest of the task.
Here is the list values gathered and set, as well as their associated OSD Variables.
- Gathered
- Computer Name: OSDComputerName
- Description: COMPUTERDESCRIPTION
- Department: DEPARTMENT
- Set
- Computer Name: OSDComputerName
- OU Path: OSDDomainOUName
- Description: COMPUTERDESCRIPTION
- Department: DEPARTMENT
- Task: TASK
Invoke-OALMenu.ps1
[-ComputerName <String>]
[-Description <String>]
[-Department <String>]
[-Seconds <Int>]
[-OSD]
Invoke-PSActiveDirectory.ps1
Based on if the Action script parameter is set to Add or Remove, this copies or removes to the Active Directory Powershell Module and it's dependences to the current System drive.
This is not a replacement to RSAT, just the raw components to use the module in scripts.
Invoke-PSActiveDirectory.ps1
[-Action <String>]
New-ComputerName.ps1
Generate a computer name based, by default this will generate a MAC style computer name. This sets the OSDComputerName OSD Variable.
If needed you set the Type script parameter to Serial and/or set the Unit script parameter to OAL to add it as a prefix.
New-ComputerName.ps1
[-Type <String>]
[-Unit <String>]
Example
PS> New-ComputerName.ps1 -Type "Serial"
9FVTV44
PS> New-ComputerName.ps1 -Type "Serial" -Unit "OAL"
OAL-9FVTV44
Remove-ADComputer.ps1
Based on the OSDComputerName value, this script removes the computer object if present in Active Directory. This is because rejoin is not allowed on the AUTH Domain
Remove-ADComputer.ps1
[-Server <String>]
Set-ADInformation.ps1
Sets the Active Directory Description and adds the Role groups to the computer object.
Set-ADInformation.ps1
[-Server <String>]
Set-OALRegistryKeys.ps1
Sets the listed enviroment varibles with their necessary values.
Evironment Registry Keys
- BUILDING
- ROOM
- DEPARTMENT
- ROLE
- OAL_CN
- VERSION
- MIRDATE
- srvcomment
Set-OALRegistryKeys.ps1